<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateStaffDimensionalityInspectionReportsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('staff_dimensionality_inspection_reports', function (Blueprint $table) {
            $table->increments('id');
			$table->unsignedInteger('company_id')->index()->comment('公司ID');
			$table->unsignedInteger('project_id')->index()->comment('项目ID');
            $table->unsignedInteger('user_id')->index()->comment('用户ID');
            $table->unsignedInteger('schedule_id')->index()->comment('用户ID');
            $table->unsignedInteger('line_id')->index()->comment('线路ID');
            $table->string('user_name')->index()->comment('姓名');
            $table->unsignedInteger('circles_count')->comment('总圈数');
            $table->unsignedInteger('circles_inspected')->comment('已完成圈数');
            $table->unsignedInteger('circles_uninspected')->comment('未完成圈数');
            $table->float('circles_rate')->comment('圈完成率');
            $table->unsignedInteger('nodes_count')->comment('总点数');
            $table->unsignedInteger('nodes_inspected')->comment('已完成点数');
            $table->unsignedInteger('nodes_uninspected')->comment('漏点数');
			$table->float('nodes_rate')->comment('点完成率');
			$table->float('nodes_punctuality')->comment('准点率');
			$table->unsignedInteger('nodes_errors')->comment('异常点数');
			$table->date('date')->index()->comment('日期');
			$table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('staff_dimensionality_inspection_reports');
    }
}
